package com.example.myproject.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.myproject.model.Torrent;
import com.example.myproject.model.TorrentTag;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TorrentMapper extends BaseMapper<Torrent> {
    @Select("SELECT * FROM torrent WHERE torrent_status = #{status}")
    List<Torrent> findByStatus(String status);

    @Select("SELECT category_name FROM category WHERE category_id = #{categoryId}")
    String getCategoryName(Long categoryId);

    @Update("UPDATE torrent SET torrent_status = #{status} WHERE torrent_id = #{id}")
    int updateStatusById(@Param("id") Long id, @Param("status") String status);
    @Select("SELECT marking_count FROM torrent  WHERE torrent_id = #{torrentId}")
    Integer getMarkingCount(Long torrentId);
    List<Torrent> selectByIdList(@Param("ids") List<Long> ids);
}